package com.rockcent.helper;

import com.rockcent.mall.lib.domain.enumclass.MallMemberRechargeType;

import java.util.Date;
import java.util.Random;

/**
 * Created by zhangjh on 2017/3/8.
 */
public enum MallMemberHelper {
    SINGLETON;


    /**
     * M端充值流水号生成规律
     *
     * @param type 充值类型
     * @return
     */
    public String createRechargeSeqNo(MallMemberRechargeType type) {
        int flag = 0;
        if (type != null) flag = type.getValue();
        String format = String.format("%02d", flag);
        Random random = new Random();
        String idRandom = String.format("%04d", random.nextInt(10000));
        return String.format("%s%s%d", idRandom,format, new Date().getTime());
    }
}
